package com.manong.controller;

import com.manong.entity.SysSalary;
import com.manong.service.SysSalaryService;
import com.manong.utils.Result;
import com.manong.vo.CommonReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/salary")
@RequiredArgsConstructor
public class SysSalaryController {

    private final SysSalaryService sysSalaryService;

    @PostMapping("/list")
    public Result list(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysSalaryService.listAll(commonReqVo)).message("用户薪资信息查询成功");
    }
    @PostMapping("/chart")
    public Result chart(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysSalaryService.chart(commonReqVo)).message("部门薪资已更新");
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysSalaryService.delete1(commonReqVo)).message("用户薪资信息删除成功");
    }

    @PostMapping("/save")
    public Result save(@RequestBody SysSalary sysSalary) {
        return Result.ok(sysSalaryService.save1(sysSalary)).message("用户薪资信息更新成功");
    }


}
